package demoMod.stsconsole.commands;

import demoMod.stsconsole.characters.AbstractPlayer;
import demoMod.stsconsole.enums.ErrType;
import demoMod.stsconsole.helpers.CharacterManager;
import demoMod.stsconsole.helpers.LocalizedStrings;
import demoMod.stsconsole.helpers.PromptHelper;
import demoMod.stsconsole.helpers.RelicLibrary;
import demoMod.stsconsole.relics.AbstractRelic;

import java.util.List;
import java.util.Scanner;

public class Play extends AbstractCommand {
    @Override
    public void execute(String[] args, Scanner sc) {
        if (args.length > 0) {
            this.errMsg(ErrType.WRONG_ARGUMENT);
            return;
        }
        List<String> cmdStrings = LocalizedStrings.getCommandStrings("Play");
        System.out.println(cmdStrings.get(0));
        int index = 0;
        for (AbstractPlayer player : CharacterManager.getAllPlayers()) {
            System.out.println(index + "\t" + player.name);
            System.out.println(cmdStrings.get(1) + player.descriptions);
            AbstractRelic startingRelic = RelicLibrary.getRelic(player.getStartingRelics().get(0));
            System.out.println(cmdStrings.get(2) + startingRelic.name);
            System.out.println(cmdStrings.get(3) + startingRelic.description);
            System.out.println(cmdStrings.get(4) + player.getGold());
            System.out.println(cmdStrings.get(5) + player.getCurrentHealth() + "/" + player.getMaxHealth());
            startingRelic.onRemove();
        }
        PromptHelper.appendPrompt("charSelect");
    }

    @Override
    public boolean requiredPrompt(String currentPrompt) {
        return "".equals(currentPrompt);
    }
}
